#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{ 
  vector<int> v{1,2,3,4,5,6};
  vector<int>::iterator it = v.begin();

  while(it != v.end())
  {
    if(*it % 2 == 0)
    {
      v.erase(it);
    }
    ++it;
  }

  for(auto e : v )
  {
    cout << e << " ";
  }
  
  cout << endl;
  return 0;
}

/*int main()
{
  vector<int> v{1,2,3,4,5};
  vector<int>::iterator it = find(v.begin(),v.end(),3);

  v.erase(it);
  cout<< *it << endl;
  
  while(it != v.end())
  {
    cout<< *it << " ";
    ++it;
  }
  cout<<endl;

  return 0;
}*/

/*int main()
{
  vector<int> v{1,2,3,4};
  for(size_t i = 0; i<v.size();++i)
    cout << v[i] << " ";
  cout << endl;
  auto it = v.begin();
  cout << "Before expansion:vector.capacity():"<<v.capacity()<<endl;
  
  v.reserve(100);
  cout<<"After expansion:vector.capacity():"<<v.capacity()<<endl;
  
  while(it != v.end())
  {
    cout << *it << " ";
    ++it;
  }
  cout << endl;

 return 0;
}*/

